---
title: 'Get started with Azure Event Hubs'
sidebarTitle: 'Azure Event Hubs'
description: 'Build real-time data pipelines with Azure Event Hubs and Postgres change data capture (CDC). Follow our step-by-step tutorial to stream database changes to Event Hubs in minutes.'
---

import QuickstartInitialSteps from '/snippets/quickstart-initial-steps.mdx';
import QuickstartSourceStep from '/snippets/quickstart-source-step.mdx';
import QuickstartBackfillStep from '/snippets/quickstart-backfill-step.mdx';

In this quickstart, you'll create a real-time data pipeline that streams changes from a Postgres database to an Azure Event Hub. You'll:

- Boot Sequin
- Connect to a sample playground database
- Configure an Event Hub to receive database changes
- See your changes flow in real-time

By the end, you'll have hands-on experience setting up Postgres change data capture (CDC) with Sequin. This same pattern can be used to setup your own Postgres CDC pipeline with Azure Event Hubs.

<Tip>
  This is the quickstart for streaming Postgres to Azure Event Hubs. See the [how-to guide](/how-to/stream-postgres-to-azure-event-hubs) for an explanation of how to use the Azure Event Hubs sink or the [reference](/reference/sinks/azure-event-hubs) for details on all configuration options.
</Tip>

## Prerequisites

- An Azure account with Event Hubs namespace
- An Event Hub within that namespace

### Create a Shared Access Policy key

While it's recommended to create a dedicated Shared Access Policy for Sequin, you can use the default policy for this quickstart:

1. In the Azure Portal, navigate to your Event Hubs namespace
2. Click "Shared access policies" in the left sidebar
3. To use the default policy:
   - Click "RootManageSharedAccessKey"
   - If no keys are present, click the "Regenerate primary key" button
   - Copy either the "Primary key" or "Secondary key"
   - Note the policy name ("RootManageSharedAccessKey")

<Steps titleSize="h2">
 <QuickstartInitialSteps />
 <Step title="Create an Event Hub Sink" icon="microsoft">
  With the playground database connected, you can create a [sink](/reference/sinks/overview). This sink will send changes to the `products` table to your Event Hub:

  <Steps>
    <Step title="Navigate to Sinks">
      Click "Sinks" in the sidebar navigation, then click "Create Sink".
    </Step>

    <Step title="Select sink type">
      Select "Azure Event Hub" as the sink type and click "Continue".
    </Step>

    <QuickstartSourceStep />
    <QuickstartBackfillStep />

    <Step title='Configure "Event Hub"'>
      In the "Event Hub Configuration" card, enter your Event Hub details:
      - Namespace: Your Event Hubs namespace (e.g., `my-namespace`)
      - Event Hub Name: The name of your Event Hub (e.g., `products`)
      - Shared Access Key Name: The name of your Shared Access Policy (e.g., `RootManageSharedAccessKey`)
      - Shared Access Key: The primary or secondary key from your Shared Access Policy

      <Frame>
        <img style={{ maxWidth: '700px' }} src="/images/quickstart/azure-event-hubs/eventhub-config-card.png" alt="Event Hub configuration card" />
      </Frame>
    </Step>

    <Step title="Test the connection">
      At the bottom of the form, click the "Test Connection" button. If you provided proper credentials, it should succeed.

      <Check>
        Sequin can connect to your Event Hub.
      </Check>
    </Step>

    <Step title="Create the sink">
      You can leave the rest of the defaults. As configured, the Event Hub will first receive a backfill of all rows currently in the `products` table. Then, it will receive all changes to the `products` table in real-time.

      Click "Create Sink" to finish setting up your Event Hub sink.
    </Step>
  </Steps>
 </Step>

  <Step title="See changes flow to your Event Hub" icon="waveform-lines">
    On the new sink's overview page, you should see the "Health" status turn green, indicating data is flowing to your Event Hub.

    Let's confirm messages are flowing:

    <Steps>
    <Step title="Messages tab">
      Click the "Messages" tab. You'll see a list of the recently delivered messages:

      <Frame>
        <img style={{ maxWidth: '700px' }} src="/images/quickstart/azure-event-hubs/messages-tab.png" alt="List of recently delivered messages" />
      </Frame>

      <Check>
        Sequin indicates it backfilled the `products` table to your Event Hub.
      </Check>
    </Step>
      <Step title="View in Azure Portal">
        In the Azure Portal:
        1. Navigate to your Event Hub
        2. Click "Process Data"
        3. Select "Data Explorer" in the left sidebar
        4. Click "View events"

        You should see a list of events. Click on any event to view its details, including its body. The messages are [`read` events](/reference/messages) from the initial backfill of the `products` table.

        <Check>
          Messages are flowing from Sequin to your Event Hub.
        </Check>
      </Step>

      <Step title="Make some changes">
        Let's make some changes to the `products` table and see them flow to your Event Hub.

        In your terminal, run the following command to insert a new row into the `products` table:

        ```bash
        docker exec -i sequin-sequin_postgres-1 \
          psql -U postgres -d sequin_playground -c \
          "insert into products (name, price) values ('Organic Honey (16 oz)', 12.99);"
        ```

        In the Data Explorer, click "View events" and you should see the new message appear.

        Feel free to try other changes:

        <AccordionGroup>
          <Accordion title="Update a product's price">
            ```bash
            docker exec -i sequin-sequin_postgres-1 \
              psql -U postgres -d sequin_playground -c \
              "update products set price = 7.99 where name = 'Avocados (3 pack)';"
            ```
          </Accordion>

          <Accordion title="Change a product's name">
            ```bash
            docker exec -i sequin-sequin_postgres-1 \
              psql -U postgres -d sequin_playground -c \
              "update products set name = 'Organic Avocados (3 pack)' where name = 'Avocados (3 pack)';"
            ```
          </Accordion>

          <Accordion title="Delete a product">
            ```bash
            docker exec -i sequin-sequin_postgres-1 \
              psql -U postgres -d sequin_playground -c \
              "delete from products where name = 'Blueberries (6 oz)';"
            ```
          </Accordion>
        </AccordionGroup>

        Each change will appear in your Event Hub within a few seconds.
      </Step>
    </Steps>
  </Step>
</Steps>

<Check>
  Great work!
</Check>

You've successfully:

- Set up a complete Postgres change data capture pipeline
- Loaded existing data through a backfill
- Made changes to the `products` table
- Verified changes are flowing to your Event Hub

## Ready to stream

Now you're ready to connect your own database to Sequin and start streaming changes:

<CardGroup cols={2}>
  <Card title="Guide: Connect Postgres" icon="elephant" href="/connect-postgres">
    Connect your Postgres database to Sequin.
  </Card>
  <Card title="Guide: Setting up an Event Hub sink" icon="microsoft" href="/how-to/stream-postgres-to-azure-event-hubs">
    Setup an Event Hub sink to send changes to your Event Hub.
  </Card>
</CardGroup>